<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<script type="text/javascript">$(function(){$('#subjectList').datagrid
({idField: 'id',title: '科目',url:'subjectController.do?datagrid&field=id,name,detail,status,sortnum,',fit:true,
loadMsg: '数据加载中...',pageSize: 10,pagination:true,sortOrder:'asc',rownumbers:true,singleSelect:true,fitColumns:true,showFooter:true,
frozenColumns:[[]],columns:[[{field:'id',title:'编号',width:30,hidden:true,sortable:true},{field:'name',title:'科目名称',width:200,sortable:true},
{field:'detail',title:'科目描述',width:200,sortable:true},{field:'status',title:'状态',width:30,sortable:true,formatter:function(value,rec,index)
{if(value=='1'){return '启用'}if(value=='2'){return '停用'}else{return value}}},{field:'sortnum',title:'排序号',width:45,sortable:true},
{field:'opt',title:'操作',width:100,formatter:function(value,rec,index){if(!rec.id){return '';}
var href='';href+="[<a href='#' onclick=delObj('subjectController.do?del&id="+rec.id +"','subjectList','删除')>";href+="删除</a>]";return href;}}]],
onClickRow:function(rowIndex,rowData){rowid=rowData.id;gridname='subjectList';}});$('#subjectList').datagrid('getPager')
.pagination({beforePageText:'',afterPageText:'/{pages}',displayMsg:'{from}-{to}共{total}条',showPageList:true,pageList:[10,20,30],showRefresh:true});
$('#subjectList').datagrid('getPager').pagination({onBeforeRefresh:function(pageNumber, pageSize){ $(this).pagination('loading');
$(this).pagination('loaded'); }});});function reloadTable(){$('#'+gridname).datagrid('reload');}function reloadsubjectList(){
$('#subjectList').datagrid('reload');}function getsubjectListSelected(field){return getSelected(field);}function getSelected(field)
{var row = $('#'+gridname).datagrid('getSelected');if(row!=null){value= row[field];}else{value='';}return value;}
function getsubjectListSelections(field){var ids = [];var rows = $('#subjectList').datagrid('getSelections');
for(var i=0;i<rows.length;i++){ids.push(rows[i][field]);}ids.join(',');return ids};function subjectListsearch(){
var queryParams=$('#subjectList').datagrid('options').queryParams;$('#subjectListtb').find('*').each(function(){queryParams[$(this).attr('name')]=
$(this).val();});$('#subjectList').datagrid({url:'subjectController.do?datagrid&field=id,name,detail,status,sortnum,'});}
function dosearch(params){var jsonparams=$.parseJSON(params);$('#subjectList').datagrid({
url:'subjectController.do?datagrid&field=id,name,detail,status,sortnum,',queryParams:jsonparams});}
function subjectListsearchbox(value,name){var queryParams=$('#subjectList').datagrid('options').queryParams;queryParams[name]=value;
queryParams.searchfield=name;$('#subjectList').datagrid('reload');}$('#subjectListsearchbox').searchbox({searcher:function(value,name){
subjectListsearchbox(value,name);},menu:'#subjectListmm',prompt:'请输入查询关键字'});
function searchReset(name){ $("#"+name+"tb").find(":input").val("");subjectListsearch();}</script>
<table width="100%" id="subjectList" toolbar="#subjectListtb"></table>
<div id="subjectListtb" style="padding: 3px;">
	<div name="searchColums"></div>
	<div style="height: 30px;" class="datagrid-toolbar">
		<span style="float: left;"><a href="#"
			class="easyui-linkbutton" plain="true" icon="icon-add"
			onclick="add('录入','subjectController.do?addorupdate','subjectList')">录入</a><a
			href="#" class="easyui-linkbutton" plain="true" icon="icon-edit"
			onclick="update('编辑','subjectController.do?addorupdate','subjectList')">编辑</a><a
			href="#" class="easyui-linkbutton" plain="true" icon="icon-search"
			onclick="detail('查看','subjectController.do?addorupdate','subjectList')">查看</a>
		</span><span style="float: right"><input id="subjectListsearchbox"
				class="easyui-searchbox"
				data-options="searcher:subjectListsearchbox,prompt:'请输入关键字',menu:'#subjectListmm'"></input>
			<div id="subjectListmm" style="width: 120px">
				<div data-options="name:'name',iconCls:'icon-ok'">
					科目名称
				</div>
			</div>
		</span>
	</div>
</div>